



* Set directory to read in data and save tables/figures
cd "G:\My Drive\Working Papers\Civil War Paper\Replication material"
 

 
use  main_analysis, clear


***********************************************************************************************************************
***********************************************************************************************************************
***********************************************************************************************************************
* DEFINE SAMPLE AND CONTROL VARIABLES HERE 
local sample "lsc1870"
local control_vars  "log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "



* Table 2: Census Education Variables- saved in data set
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

 * Education Table: Create table for paper 
 xtreg per_black_lit_1870 troops_pop_1860   `control_vars'   if `sample'==1,robust fe i(stateid)
 gen sample=e(sample)
 
 * create table 2
 gen var_black=" "
 
 gen mean_black=.
 gen n_black=.
 
 gen mean_white=.
 gen n_white=.
  gen var_white=" "
 
 local n=1
 foreach var in per_black_lit_1870 per_black_lit_1900 per_black_lit_1910 per_black_lit_1920  { 
 
     replace var_black="`var'" if _n==`n'
 
	 sum `var' if sample==1
	 replace mean_black=r(mean) if _n==`n'
	 replace n_black=r(N) if _n==`n'
	 
	 
 local n=`n'+1
 
 }

 
  local n=1
 foreach var in  per_white_lit_1870 per_white_lit_1900 per_white_lit_1910 per_white_lit_1920  { 
 
     replace var_white="`var'" if _n==`n'
 
	 sum `var' if sample==1
	 replace mean_white=r(mean) if _n==`n'
	 replace n_white=r(N) if _n==`n'
	 
	 
 local n=`n'+1
 
 }

	
	
 gen diff=mean_black-mean_white
 
 


**************************************************************************************************
* Part 1: Predicting Occupation
**************************************************************************************************
 
* Table 3

local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
local sample "lsc1870"
	
	eststo occ4: xtreg troops_pop_1860  union_deaths conf_deaths  `control_vars'   if `sample'==1, fe i(stateid) robust

esttab  occ4  using "table_3.tex", title(Predicting Union Occupation\label{occ1}) replace mtitles( "Troops as \% Pop" )  cells(b (fmt(3)) se(par fmt(3)))  label  width(1\hsize)  ///
   addnote(Note: OLS coefficients are reported. All independent variables except \textit{Union Deaths} and \textit{Confederate Deaths} are from 1860. State fixed effects are included and robust standard errors are reported.) 




 **************************************************************************************************
* Part 2: Predicting Success of  Occupation
*         Education
**************************************************************************************************					
							
							
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

* Table 4
	eststo ed_ss1_l: xtreg per_black_lit_1870 fb_office occup_binary `control_vars' if `sample'==1,robust fe i(stateid)
	eststo ed_ss2_l: xtreg  per_black_lit_1900   fb_office troops_pop_1860    time_occup_months `control_vars' if `sample'==1,robust fe i(stateid)
	eststo ed_ss3_l: xtreg  per_black_lit_1910   fb_office troops_pop_1860    time_occup_months `control_vars' if `sample'==1,robust fe i(stateid)
	eststo ed_ss4_l: xtreg  per_black_lit_1920   fb_office troops_pop_1860    time_occup_months `control_vars'  if `sample'==1,robust fe i(stateid)


esttab ed_ss1_l ed_ss2_l ed_ss3_l ed_ss4_l  using "table_4.tex", title(Predicting Literacy of Blacks, Slave States \label{ed1}) replace  label cells(b( fmt(3)) se(par fmt(3)))   width(0.9\hsize)  ///
	mtitle("1870" "1900" "1910" "1920" ) ///
	addnote(Note: The dependent variable is the literacy rate of the Black population for that time period. Other than occupation variables, independent variables are from 1860. State fixed effects are included and robust standard errors are reported.)
 
   
 eststo ed1_l: xtreg per_black_lit_1870 fb_office occup_binary  `control_vars'   if `sample'==1,robust fe i(stateid)

					
* Figure 3a (note- on occasion STATA will have issues estimating the standard errors for the figures. If they do not come up, re-run it)
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

	 eststo ed2_l: xtreg per_black_lit_1900    fb_office troops_pop_1860    time_occup_months `control_vars'   if `sample'==1,robust fe i(stateid)
	 eststo time_edd2_l: margins, at(troops_pop_1860=(0(1)50)) post
	
	 eststo ed3_l: xtreg per_black_lit_1910    fb_office troops_pop_1860    time_occup_months `control_vars'  if `sample'==1,robust fe i(stateid)
	 eststo time_edd3_l: margins, at(troops_pop_1860=(0(2)50)) post

	 eststo ed4_l: xtreg per_black_lit_1920    fb_office troops_pop_1860    time_occup_months `control_vars'   if `sample'==1,robust fe i(stateid)
	 eststo time_edd4_l: margins, at(troops_pop_1860=(0(1)50)) post		
	 
						   
  coefplot (time_edd2_l, label(1900))   (time_edd3_l, label(1910)) (time_edd4_l, label(1920)) ,  at ytitle("Percent Black Literate", size(vlarge)) ylabel(, angle(horizontal))  ///
	xtitle({bf:Troops as % Pop.}, size(large)) xscale(titlegap(4)) scheme(s1mono)   recast(line) lwidth(*3) ciopts(recast(rline) lpattern(dash)) legend(col(3))
	graph export figure_3a.pdf, as(pdf) replace  
						
					  
							
	 

local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "


* Table 5
eststo edd_sc1: xtreg litwb_diff_1870 fb_office occup_binary  `control_vars'  if lsc==1,robust fe i(stateid)
eststo edd_sc2: xtreg litwb_diff_1900  fb_office troops_pop_1860 time_occup_months `control_vars'  if lsc==1,robust fe i(stateid)
eststo edd_sc3: xtreg litwb_diff_1910 fb_office troops_pop_1860 time_occup_months `control_vars' if lsc==1,robust fe i(stateid)
eststo edd_sc4: xtreg litwb_diff_1920  fb_office troops_pop_1860 time_occup_months `control_vars'  if lsc==1,robust fe i(stateid)

esttab edd_sc1 edd_sc2 edd_sc3 edd_sc4 using "table_5.tex", title(Predicting Differences in Literacy Rates, Slave States\label{eddifss}) replace  label cells(b( fmt(3)) se(par fmt(3)))    width(0.9\hsize)  ///
	mtitle("1870" "1900" "1910" "1920" ) ///
	addnotes( Note: The dependent variable is the difference in illiteracy rates between white population and the Black population for that time period. Other than occupation variables, independent variables are from 1860. State fixed effects are included and robust standard errors are reported. )
   * starlevels(* 0.10 ** 0.05 *** 0.01)




* Figure 3b
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

	eststo edd_sc2: reg litwb_diff_1900 fb_office troops_pop_1860 time_occup_months `control_vars' i.stateid if `sample'==1,robust
	eststo diff_edd1: margins, at(troops_pop_1860=(0(1)50)) post
	
	eststo edd_sc3: reg litwb_diff_1910  fb_office troops_pop_1860 time_occup_months `control_vars'  i.stateid if `sample'==1,robust 
	eststo diff_edd2: margins, at(troops_pop_1860=(0(1)50)) post


	eststo edd_sc4: reg litwb_diff_1920  fb_office troops_pop_1860 time_occup_months `control_vars' i.stateid  if `sample'==1,robust 
	eststo diff_edd3: margins, at(troops_pop_1860=(0(1)50)) post
	   
	coefplot (diff_edd1, label(1900))   (diff_edd2, label(1910)) (diff_edd3, label(1920)) , at ytitle("White-Black Diff. in Literacy ", size(vlarge)) ylabel(, angle(horizontal))  xtitle({bf:Troops as % Pop.}, size(large)) xscale(titlegap(4)) ///
		 scheme(s1mono)  recast(line) lwidth(*3) ciopts(recast(rline) lpattern(dash)) legend(col(3))
	graph export figure_3b.pdf, as(pdf) replace 
					


  
  ************************************************************************************************************
  * Part 3: Predicting Violence when occupation has success
  ************************************************************************************************************
* Table 6
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
	eststo llc1n:  nbreg b_lynch_1911_1920 black_lit_change_1910_1900  `control_vars'  i.stateid if `sample'==1,robust 
	eststo llc4n:  nbreg b_lynch_1921_1930 black_lit_change_1920_1910     `control_vars'  i.stateid if `sample'==1,robust 


	eststo llc5n:  nbreg b_lynch_1911_1920 bw_diff_difflit_1910_1900    `control_vars'  i.stateid if `sample'==1,robust 
	eststo llc8n:  nbreg b_lynch_1921_1930 bw_diff_difflit_1920_1910   `control_vars'  i.stateid if `sample'==1,robust 


esttab llc1n  llc4n llc5n    llc8n using "table_6.tex", title(Predicting Black Lynching\label{changelynch1}) replace  label cells(b( fmt(3)) se(par fmt(3)))     ///
	mtitle("1911-1920" "1921-1930" "1911-1920" "1921-1930" )
	
* Figure 5a* 
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
nbreg b_lynch_1911_1920 black_lit_change_1910_1900  `control_vars' i.stateid if `sample'==1,robust 
eststo predlynch1: margins, at((p10) black_lit_change_1910_1900) post 
nbreg b_lynch_1911_1920 black_lit_change_1910_1900  `control_vars' i.stateid if `sample'==1,robust 
eststo predlynch2: margins, at((p90) black_lit_change_1910_1900) post
		
nbreg b_lynch_1921_1930 black_lit_change_1920_1910     `control_vars'  i.stateid if `sample'==1,robust 
eststo predlynch3: margins, at((p10) black_lit_change_1920_1910) post
nbreg b_lynch_1921_1930 black_lit_change_1920_1910     `control_vars'  i.stateid if `sample'==1,robust 
eststo predlynch4: margins, at((p90) black_lit_change_1920_1910) post 

coefplot (predlynch1, label(Small Change (10th Percentile))) (predlynch2, label(Large Change (90th Percentile))), bylabel(1900-1910) || ///
 predlynch3 predlynch4, bylabel(1910-1920) ///
  scheme(s1mono) ylabel(, angle(horizontal)) vertical ///
  	xtitle({bf:Change in Black Literacy}, size(large)) xscale(titlegap(4)) ///
	ytitle("Expected White-on-Black Lynchings", size(large)) ///
	xlabel("")  byopts(compact row(1))
	graph export figure_5a.pdf, as(pdf) replace 
	
	
* Figure 5b* 
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
nbreg b_lynch_1911_1920 bw_diff_difflit_1910_1900    `control_vars'  i.stateid if `sample'==1,robust 
eststo predlynchdiff1: margins, at((p10) bw_diff_difflit_1910_1900) post 
nbreg b_lynch_1911_1920 bw_diff_difflit_1910_1900    `control_vars'  i.stateid if `sample'==1,robust 
eststo predlynchdiff2: margins, at((p90) bw_diff_difflit_1910_1900) post 

nbreg b_lynch_1921_1930 bw_diff_difflit_1920_1910    `control_vars'  i.stateid if `sample'==1,robust 
eststo predlynchdiff3: margins, at((p10) bw_diff_difflit_1920_1910) post 
nbreg b_lynch_1921_1930 bw_diff_difflit_1920_1910    `control_vars'  i.stateid if `sample'==1,robust 
eststo predlynchdiff4: margins, at((p90) bw_diff_difflit_1920_1910) post 

coefplot (predlynchdiff2, label(Small Reduction in Black-White Differences in Literacy Rates (90th Percentile)))  (predlynchdiff1, label(Large Reduction in Black-White Differences in Literacy Rates (10th Percentile))), bylabel(1911-1920) || ///
predlynchdiff4  predlynchdiff3 , bylabel(1921-1930) ///
  scheme(s1mono) ylabel(, angle(horizontal)) vertical ///
  	xtitle({bf:Change in Black Literacy Relative to White Literacy}, size(large)) xscale(titlegap(4)) ///
	ytitle("Expected White-on-Black Lynchings", size(large)) ///
	xlabel("")  byopts(compact row(1)) legend(col(1) size(vsmall))
	graph export figure_5b.pdf, as(pdf) replace 

	
	
	
**************************************	
* Appendix Tables			
**************************************
				
* Table A.1	
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

eststo occ1a:logit occup_binary union_deaths conf_deaths fbprop `control_vars' i.stateid if `sample'==1,  robust
eststo occ1: xtreg time_occup_months  union_deaths conf_deaths fbprop `control_vars'  if `sample'==1, fe i(stateid) robust
eststo occ6: xtreg troops_per_sqmile1860  union_deaths conf_deaths fbprop `control_vars'  if `sample'==1, fe i(stateid) robust
eststo occ5: logit fb_office  union_deaths conf_deaths  fbprop `control_vars'  i.stateid if `sample'==1,  robust

esttab occ1a occ1  occ6 occ5 using "table_a1.tex", title(Predicting Union Occupation\label{occ1}) replace mtitles("Occup. Binary" "Month Occup." "Troops Per Square Mile" "FB Yes\/No")  cells(b (fmt(3)) se(par fmt(3)))  label  width(1\hsize)  ///
   drop(2.stateid 41.stateid 3.stateid 10.stateid 11.stateid  19.stateid   26.stateid 28.stateid 43.stateid 44.stateid 46.stateid) ///)
   addnote(Note: OLS coefficients are reported in columns 2 and 3 and logistic coefficients are reported in 1 and 4. All independent variables except \textit{Union Deaths} and \textit{Confederate Deaths} are from 1860. State fixed effects are included and robust standard errors are reported.) 
* starlevels(* 0.10 ** 0.05 *** 0.01)



* Table A.2 			
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "


	eststo ed_ss1_l: xtreg per_black_lit_1870 fb_office occup_binary `control_vars' if `sample'==1,robust fe i(stateid)
	eststo ed_ss2_l: xtreg  per_black_lit_1900   fb_office troops_per_sqmile1860    time_occup_months `control_vars' if `sample'==1,robust fe i(stateid)
	eststo ed_ss3_l: xtreg  per_black_lit_1910   fb_office troops_per_sqmile1860    time_occup_months `control_vars' if `sample'==1,robust fe i(stateid)
	eststo ed_ss4_l: xtreg  per_black_lit_1920   fb_office troops_per_sqmile1860    time_occup_months `control_vars'  if `sample'==1,robust fe i(stateid)
				
esttab ed_ss1_l ed_ss2_l ed_ss3_l ed_ss4_l using "table_a2.tex", title(Black Literacy Rates, Alternative Explanatory Measures) replace mtitles("1870" "1900" "1910" "1902")  cells(b (fmt(3)) se(par fmt(3)))  label  width(1\hsize)  ///
   addnote(Note: The dependent variable is literacy rate of the black population for that time period. Other than occupation variables, independent variables are from 1860. State fixed effects are included and robust standard errors are reported.) 
* starlevels(* 0.10 ** 0.05 *** 0.01)

				
				
				
* Table A.7 Add electoral Competition 
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
	
	eststo llc1n:  nbreg b_lynch_1911_1920 black_lit_change_1910_1900  elect_comp_pdem1908  `control_vars'  i.stateid if `sample'==1,robust 
	eststo llc4n:  nbreg b_lynch_1921_1930 black_lit_change_1920_1910 elect_comp_pdem1920    `control_vars'  i.stateid if `sample'==1,robust 
	eststo llc5n:  nbreg b_lynch_1911_1920 bw_diff_difflit_1910_1900   elect_comp_pdem1908 `control_vars'  i.stateid if `sample'==1,robust 
	eststo llc8n:  nbreg b_lynch_1921_1930 bw_diff_difflit_1920_1910  elect_comp_pdem1920  `control_vars'  i.stateid if `sample'==1,robust 

esttab llc1n  llc4n llc5n    llc8n using "table_a7.tex", title(Predicting Black Lynching\label{changelynch1}) replace  label cells(b( fmt(3)) se(par fmt(3)))     ///
	mtitle("1911-1920" "1921-1930" "1911-1920" "1921-1930" )
	
	
	* Table A.8, OLS Regression
 local sample "lsc1870" 
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

	eststo llc1:  xtreg b_lynch_1911_1920 black_lit_change_1910_1900    `control_vars' if `sample'==1,robust fe i(stateid)
	eststo llc4:  xtreg b_lynch_1921_1930 black_lit_change_1920_1910     `control_vars'   if `sample'==1,robust fe i(stateid)
	eststo llc5:  xtreg b_lynch_1911_1920 bw_diff_difflit_1910_1900    `control_vars'  if `sample'==1,robust fe i(stateid)
	eststo llc8:  xtreg b_lynch_1921_1930 bw_diff_difflit_1920_1910   `control_vars'   if `sample'==1,robust fe i(stateid)

	esttab llc1  llc4 llc5    llc8 using "table_a8.tex", title(Predicting Black Lynching\label{changelynch1}) replace  label cells(b( fmt(3)) se(par fmt(3)))     ///
	mtitle("1911-1920" "1921-1930" "1911-1920" "1921-1930" )
	
	
	* Table A.9 Add electoral competition, OLS Regression 	
 local sample "lsc1870" 
 local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

	eststo llc1:  xtreg b_lynch_1911_1920 black_lit_change_1910_1900  elect_comp_pdem1908  `control_vars' if `sample'==1,robust fe i(stateid)
	eststo llc4:  xtreg b_lynch_1921_1930 black_lit_change_1920_1910 elect_comp_pdem1920    `control_vars'   if `sample'==1,robust fe i(stateid)
	eststo llc5:  xtreg b_lynch_1911_1920 bw_diff_difflit_1910_1900   elect_comp_pdem1908 `control_vars'  if `sample'==1,robust fe i(stateid)
	eststo llc8:  xtreg b_lynch_1921_1930 bw_diff_difflit_1920_1910  elect_comp_pdem1920  `control_vars'   if `sample'==1,robust fe i(stateid)
esttab llc1  llc4 llc5    llc8 using "table_a9.tex", title(Predicting Black Lynching\label{changelynch1}) replace  label cells(b( fmt(3)) se(par fmt(3)))     ///
	mtitle("1911-1920" "1921-1930" "1911-1920" "1921-1930" )
 



 
 * Table A.12
   local n=20
 foreach var in  black_church {
     replace var_black="`var'" if _n==`n'
 
	 sum `var' if sample==1
	 replace mean_white=r(mean) if _n==`n'
	 replace n_white=r(N) if _n==`n'
	 
	 
 local n=`n'+1
 
 }

 
 
 
  
* Table A.13 Churches

local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "

	eststo churchl: xtreg  per_black_lit_1900   black_church `control_vars' if `sample'==1,robust fe i(stateid)
	eststo church2: xtreg  per_black_lit_1910   black_church `control_vars' if `sample'==1,robust fe i(stateid)
	eststo church3: xtreg  per_black_lit_1920   black_church `control_vars' if `sample'==1,robust fe i(stateid)			

esttab churchl church2 church3 using "table_a13.tex", title(Black Churches and Black Literacy\label{church}) replace  label cells(b( fmt(3)) se(par fmt(3)))    width(0.9\hsize)   
  * starlevels(* 0.10 ** 0.05 *** 0.01)

  * Table A.14
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
	
	eststo church4:  nbreg b_lynch_1901_1910  black_church  `control_vars'  i.stateid if `sample'==1,robust 
	eststo church5:  nbreg b_lynch_1911_1920  black_church  `control_vars'  i.stateid if `sample'==1,robust 
	eststo church6:  nbreg b_lynch_1921_1930  black_church    `control_vars'  i.stateid if `sample'==1,robust 

esttab church4 church5 church6 using "table_a14.tex", title(Black Churches and White-on-Black Lynching\label{church2}) replace  label cells(b( fmt(3)) se(par fmt(3)))    width(0.9\hsize)   

 
* Table A.15
local sample "lsc1870"
local control_vars " log_totpop sprop fbprop sfarmprop acimp   landineq  farmval fvalpc rail  water cottonsuit rugged "
	eststo wagel: xtreg  blklwage1940  troops_pop_1860     fb_office  time_occup_months `control_vars' if `sample'==1,robust fe i(stateid)
	eststo wage2: xtreg  blklwage1940    troops_per_sqmile1860 fb_office   time_occup_months `control_vars' if `sample'==1,robust fe i(stateid)

 esttab wagel wage2 using "table_a15.tex", title(Predicting Black Wages in 1940\label{wage1}) replace  label cells(b( fmt(3)) se(par fmt(3)))    width(0.9\hsize)   
 
 
 
 
 
 
 
 
 
 
 
 

*********************************************************************************************************
 * CHANGE DATA SET 
*********************************************************************************************************


use diff_diff_data_set, clear


* note: time is a dummy variable. 0 is the base year (1850) and 1 refers to time after Reconstruction
* The variable name indicates the year that it is
* As an example, per_lit_white_1900_ measures percent white literacy at two time points- 1850 (when time is 0) and 1900 (when time is 1)




			
***FIGURE 4****
local control_vars "log_totpop  sfarmprop_ acimp_ farmval_   fvalpac1860 landineq  sprop fbprop  rail  water cottonsuit  rugged"
local sample "lsc1870"
xtreg per_lit_black_slaves_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m0: margins , at(occup_binary =(0) time=(0)) post level(95)
xtreg per_lit_black_slaves_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m1: margins , at(occup_binary =(1) time=(0)) post level(95)
xtreg per_lit_black_slaves_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m2: margins , at(occup_binary =(0) time=(1)) post level(95)
xtreg per_lit_black_slaves_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m3: margins , at(occup_binary =(1) time=(1)) post level(95)
xtreg per_lit_white_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m4: margins , at(occup_binary =(0) time=(0)) post level(95)
xtreg per_lit_white_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m5: margins , at(occup_binary =(1) time=(0)) post level(95)
xtreg per_lit_white_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m6: margins , at(occup_binary =(0) time=(1)) post level(95)
xtreg per_lit_white_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m7: margins , at(occup_binary =(1) time=(1)) post level(95)
				
xtreg per_lit_black_slaves_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m10: margins , at(occup_binary =(0) time=(0)) post level(95)
xtreg per_lit_black_slaves_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m11: margins , at(occup_binary =(1) time=(0)) post level(95)
xtreg per_lit_black_slaves_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m12: margins , at(occup_binary =(0) time=(1)) post level(95)
xtreg per_lit_black_slaves_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m13: margins , at(occup_binary =(1) time=(1)) post level(95)
xtreg per_lit_white_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m14: margins , at(occup_binary =(0) time=(0)) post level(95)
xtreg per_lit_white_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m15: margins , at(occup_binary =(1) time=(0)) post level(95)
xtreg per_lit_white_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m16: margins , at(occup_binary =(0) time=(1)) post level(95)
xtreg per_lit_white_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m17: margins , at(occup_binary =(1) time=(1)) post level(95)				

xtreg per_lit_black_slaves_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m20: margins , at(occup_binary =(0) time=(0)) post level(95)
xtreg per_lit_black_slaves_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m21: margins , at(occup_binary =(1) time=(0)) post level(95)
xtreg per_lit_black_slaves_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m22: margins , at(occup_binary =(0) time=(1)) post level(95)
xtreg per_lit_black_slaves_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m23: margins , at(occup_binary =(1) time=(1)) post level(95)
xtreg per_lit_white_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m24: margins , at(occup_binary =(0) time=(0)) post level(95)
xtreg per_lit_white_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
         		eststo m25: margins , at(occup_binary =(1) time=(0)) post level(95)
xtreg per_lit_white_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m26: margins , at(occup_binary =(0) time=(1)) post level(95)
xtreg per_lit_white_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
				eststo m27: margins , at(occup_binary =(1) time=(1)) post level(95)				

				
			   
  

  
coefplot (m2, label(Black Literacy, (Post-Reconstruction, No Troops)) msymbol(o) mcolor(black)) ///
(m3, label(Black Literacy, (Post-Reconstruction, Troops)) msymbol(d) mcolor(black)) ///
(m6, label(White Literacy, (Post-Reconstruction, No Troops)) msymbol(o) mcolor(gs8)) ///
(m7, label(White Literacy, (Post-Reconstruction, Troops)) msymbol(d) mcolor(gs8)), bylabel(1900) ///
|| (m12, msymbol(o) mcolor(black)) ///
(m13, msymbol(d) mcolor(black)) ///
(m16, msymbol(o) mcolor(gs8)) ///
(m17, msymbol(d) mcolor(gs8)),  bylabel(1910) ///
|| (m22, msymbol(o) mcolor(black)) ///
(m23, msymbol(d) mcolor(black)) ///
(m26, msymbol(o) mcolor(gs8)) ///
(m27, msymbol(d) mcolor(gs8)), bylabel(1920) ///
  scheme(s1mono) vertical   mlabel   format( %9.1f)	xlabel("") 	ytitle(Change in Literacy Rates, size(large)) ///
  ysize(12) xsize(20) legend(col(2) size(vsmall)) byopts(compact row(1)) 

  graph export figure_4.pdf, as(pdf) replace		   
  
  
 
			
			

**FIGURE 6**
local control_vars "log_totpop  sfarmprop_ acimp_ farmval_   fvalpac1860 landineq  sprop fbprop  rail  water cottonsuit  rugged"
local sample "lsc1870"	
nbreg lynch_10h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m0: margins , at(occup_binary =(0) time=(0)) post level(95)
nbreg lynch_10h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m1: margins , at(occup_binary =(1) time=(0)) post level(95)
nbreg lynch_10h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m2: margins , at(occup_binary =(0) time=(1)) post level(95)
nbreg lynch_10h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m3: margins , at(occup_binary =(1) time=(1)) post level(95)
nbreg lynch_20h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m10: margins , at(occup_binary =(0) time=(0)) post level(95)
nbreg lynch_20h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m11: margins , at(occup_binary =(1) time=(0)) post level(95)
nbreg lynch_20h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m12: margins , at(occup_binary =(0) time=(1)) post level(95)
nbreg lynch_20h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m13: margins , at(occup_binary =(1) time=(1)) post level(95)
nbreg lynch_50h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m20: margins , at(occup_binary =(0) time=(0)) post level(95)
nbreg lynch_50h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m21: margins , at(occup_binary =(1) time=(0)) post level(95)
nbreg lynch_50h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m22: margins , at(occup_binary =(0) time=(1)) post level(95)
nbreg lynch_50h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars'  i.stateid if `sample'==1, robust
         		eststo m23: margins , at(occup_binary =(1) time=(1)) post level(95)
				
coefplot (m0, label(Reconstruction, No Troops) msymbol(o) mcolor(gray)) /// 
(m1, label(Reconstruction, Troops) msymbol(d) mcolor(gray))  ///
(m2, label(Post-Reconstruction, No Troops) msymbol(o) mcolor(black)) ///
(m3, label(Post-Reconstruction, Troops) msymbol(d) mcolor(black)), bylabel(10 Years)   ///
|| (m10, msymbol(o) mcolor(black)) /// 
(m11, msymbol(d) mcolor(gray))  ///
(m12, msymbol(o) mcolor(black)) ///
(m13, msymbol(d) mcolor(gray)), bylabel(20 Years)   ///
|| (m20, msymbol(oh) mcolor(black)) /// 
(m21, msymbol(dh) mcolor(gray))  ///
(m22, msymbol(o) mcolor(black)) ///
(m23, msymbol(d) mcolor(gray)), bylabel(50 Years) ///
  scheme(s1mono) vertical 	xlabel("") 	ytitle(Expected White-on-Black Lynching, size(large)) ///
  ysize(12) mlabel  format( %9.1f)	xlabel("") xsize(20) legend(col(2) size(vsmall)) byopts(compact row(1))
  
graph export figure_6.pdf, as(pdf) replace		 





* Tables 				


 
 * Table A.3: 1900 LITERACY
 
local control_vars "log_totpop  sfarmprop_ acimp_ farmval_   fvalpac1860 landineq  sprop fbprop  rail  water cottonsuit  rugged"
local sample "lsc1870"
					
eststo des1900: xtreg per_lit_black_slaves_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
eststo dew1900: xtreg per_lit_white_1900_ i.time##i.fb_office  i.time##i.occup_binary     `control_vars' if `sample'==1, robust fe i(stateid)

esttab  des1900 dew1900  using "table_a3.tex", title(Difference in Difference 1850 to 1900: Predicting Literacy Slave States \label{diffed1}) replace  label cells(b( fmt(3)) se(par fmt(3)))   width(0.9\hsize)  ///
	mtitle("Slaves" "White" ) ///
	addnote(Note: The dependent variable is the Literacy rate of the Black population for 1850 or 1900. State fixed effects are included and robust standard errors are reported.)
		
 
  * Table A.4: 1910
eststo des1910: xtreg per_lit_black_slaves_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)							
eststo dew1910: xtreg per_lit_white_1910_ i.time##i.fb_office  i.time##i.occup_binary     `control_vars' if `sample'==1, robust fe i(stateid)
 
 
esttab  des1910 dew1910  using "table_a4.tex", title(Difference in Difference 1850 to 1910: Predicting Literacy Slave States \label{diffed2}) replace  label cells(b( fmt(3)) se(par fmt(3)))   width(0.9\hsize)  ///
	mtitle("Slaves" "White" ) ///
	addnote(Note: The dependent variable is the Literacy rate of the Black population for 1850 or 1910. State fixed effects are included and robust standard errors are reported.)
 
 
 * Table A.5:  1920							
eststo des1920: xtreg per_lit_black_slaves_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1, robust fe i(stateid)
eststo dew1920: xtreg per_lit_white_1920_ i.time##i.fb_office  i.time##i.occup_binary     `control_vars' if `sample'==1, robust fe i(stateid)
 
 
esttab des1920 dew1920  using "table_a5.tex", title(Difference in Difference 1850 to 1920: Predicting Literacy Slave States \label{diffed3}) replace  label cells(b( fmt(3)) se(par fmt(3)))   width(0.9\hsize)  ///
	mtitle( "Slaves" "White" ) ///
	addnote(Note: The dependent variable is the Literacy rate of the Black population for 1850 or 1920. State fixed effects are included and robust standard errors are reported.)
 
 



 
 *Table A6:  margins charts
 	local control_vars "log_totpop  sfarmprop_ acimp_ farmval_   fvalpac1860 landineq  sprop fbprop  rail  water cottonsuit  rugged"	
	local sample "lsc1870"
	
 	xtreg per_lit_black_slaves_1900_      i.time##i.fb_office  i.time##i.occup_binary    `control_vars' if `sample'==1 , robust fe i(stateid)	
			margins , at(occup_binary =(0(1)1) time=(0(1)1)) post level(95)
				margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
	
					
  	xtreg per_lit_black_slaves_1910_      i.time##i.fb_office  i.time##i.occup_binary    `control_vars' if `sample'==1 , robust fe i(stateid)	
			margins , at(occup_binary =(0(1)1) time=(0(1)1)) post level(95)
				margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
					
 	xtreg per_lit_black_slaves_1920_      i.time##i.fb_office  i.time##i.occup_binary    `control_vars' if `sample'==1 , robust fe i(stateid)	
			margins , at(occup_binary =(0(1)1) time=(0(1)1)) post level(95)
			
				margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
 	margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
 xtreg per_lit_white_1900_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
			margins , at(occup_binary =(0(1)1) time=(0(1)1)) post level(95)
				margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
	xtreg per_lit_white_1910_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
			margins , at(occup_binary =(0(1)1) time=(0(1)1)) post level(95)
				margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
	xtreg per_lit_white_1920_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' if `sample'==1 , robust fe i(stateid)	
			margins , at(occup_binary =(0(1)1) time=(0(1)1)) post level(95)
				margins, coeflegend
					test  _b[1bn._at]= _b[2._at]
					test  _b[3._at]= _b[4._at]
	
			

			
			
local sample "lsc1870"
local control_vars "log_totpop  sfarmprop_ acimp_ farmval_   fvalpac1860 landineq  sprop fbprop  rail  water cottonsuit  rugged"
	
	


* Table  A.10 For prediction tables:			 
		eststo l10: nbreg lynch_10h_   i.time##i.fb_office  i.time##i.occup_binary  `control_vars' i.stateid if `sample'==1, robust	
		eststo l20: nbreg lynch_20h_   i.time##i.fb_office  i.time##i.occup_binary   `control_vars' i.stateid if `sample'==1 , robust 				
		eststo l50: nbreg lynch_50h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' i.stateid if `sample'==1, robust
				  
esttab l10 l20    l50 using "table_10.tex", title(Difference in Difference: Predicting Lynching in Slave States \label{difflynch}) replace  label cells(b( fmt(3)) se(par fmt(3)))   width(0.9\hsize)  ///
mtitle("10 years" "20 years" "50 years" ) ///
addnote(Note: The dependent variable is the number of lynchings during the Reconstruction during time 0 and either 10, 20, or 50 years after Reconstruction during time 1.  State fixed effects are included and robust standard errors are reported.)



	 * Table A11
local control_vars "log_totpop  sfarmprop_ acimp_ farmval_   fvalpac1860 landineq  sprop fbprop  rail  water cottonsuit  rugged"
local sample "lsc1870"		 
		
		nbreg lynch_10h_   i.time##i.fb_office  i.time##i.occup_binary  `control_vars'  i.stateid if `sample'==1, robust 
		margins,  at(occup_binary=(0(1)1)time=(0(1)1)) post level(95)
		margins, coeflegend
		test  _b[1bn._at]= _b[2._at]
		test  _b[3._at]= _b[4._at]
					
		nbreg lynch_20h_   i.time##i.fb_office  i.time##i.occup_binary   `control_vars' i.stateid if `sample'==1 , robust
		margins,  at(occup_binary=(0(1)1) time=(0(1)1)) post level(95)
		margins, coeflegend
		test  _b[1bn._at]= _b[2._at]
		test  _b[3._at]= _b[4._at]
				
		nbreg lynch_50h_   i.time##i.fb_office  i.time##i.occup_binary `control_vars' i.stateid if `sample'==1, robust 
		margins,  at(occup_binary=(0(1)1) time=(0(1)1)) post level(95)
		margins, coeflegend
		test  _b[1bn._at]= _b[2._at]
		test  _b[3._at]= _b[4._at]				
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
	
 
